import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;


public class Connect {

	/**
	 * @param args
	 */
	public static void main(String[] args) throws SQLException {
		DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());

        Connection conn = DriverManager.getConnection
            ("jdbc:oracle:thin:@146.187.134.17:1542:oracle10g", "cscd494", "R3tral435");
                            // @machineName:port:SID,   userid,  password

        Statement stmt = conn.createStatement();
        ResultSet rset = stmt.executeQuery("select * FROM president");
        while (rset.next())
              System.out.println (rset.getString(2));   // Print col 1
        stmt.close();

	}

}
